package com.cyjt.operation.ui;

import com.cyjt.operation.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import cn.jpush.android.api.JPushInterface;

/**
 * 功能面板的Activity
 * 
 * @author LTP
 * 
 */
public class HomeActivity extends Activity implements OnClickListener {
	/** 设备状态按键 */
	private ImageView imageView_home_device_state;
	/** 工单管理按键 */
	private ImageView imageView_home_workOrder_management;
	/** 消息管理按键 */
	private ImageView imageView_home_message_management;
	/** 工作量统计按键 */
	private ImageView imageView_home_work_account;
	/** 部署按键 */
	private ImageView imageView_home_deploy;
	/** 问题反馈按键 */
	private ImageView imageView_home_feedBack;
	/** 我的运维按键 */
	private ImageView imageView_home_my_operation;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_home);
		initView();
		Intent intent = getIntent();
		if (intent.getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) {
			Bundle bundle = getIntent().getExtras();
			String title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
			String content = bundle.getString(JPushInterface.EXTRA_ALERT);
			Log.i("push", "Title : " + title + "  " + "Content : " + content);
		}
	}

	/**
	 * 控件初始化
	 */
	private void initView() {
		imageView_home_device_state = (ImageView) findViewById(R.id.imageView_home_device_state);
		imageView_home_device_state.setOnClickListener(this);
		imageView_home_workOrder_management = (ImageView) findViewById(R.id.imageView_home_workOrder_management);
		imageView_home_workOrder_management.setOnClickListener(this);
		imageView_home_message_management = (ImageView) findViewById(R.id.imageView_home_message_management);
		imageView_home_message_management.setOnClickListener(this);
		imageView_home_work_account = (ImageView) findViewById(R.id.imageView_home_work_account);
		imageView_home_work_account.setOnClickListener(this);
		imageView_home_deploy = (ImageView) findViewById(R.id.imageView_home_deploy);
		imageView_home_deploy.setOnClickListener(this);
		imageView_home_feedBack = (ImageView) findViewById(R.id.imageView_home_feedBack);
		imageView_home_feedBack.setOnClickListener(this);
		imageView_home_my_operation = (ImageView) findViewById(R.id.imageView_home_my_operation);
		imageView_home_my_operation.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.imageView_home_device_state:
			// TODO 跳转到设备管理的Activity
			startActivity(new Intent(this, DeviceStatusActivity.class));
			break;
		case R.id.imageView_home_workOrder_management:
			// TODO 跳转到工单管理的Activity
			startActivity(new Intent(this, WorkOrderManagementActivity.class));
			break;
		case R.id.imageView_home_message_management:
			// 跳转到消息管理的Activity
			startActivity(new Intent(this, MessageManagementActivity.class));
			break;
		case R.id.imageView_home_work_account:

			break;
		case R.id.imageView_home_deploy:
			// TODO 跳转到部署的Activity
			startActivity(new Intent(this, DeployActivity.class));
			break;
		case R.id.imageView_home_feedBack:

			break;
		case R.id.imageView_home_my_operation:
			// TODO 跳转到我的运维的Activity
			startActivity(new Intent(this, MyOperationActivity.class));
			break;
		default:
			break;
		}

	}
}
